package com.briup.appointment.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.briup.appointment.common.ApiResponse;
import com.briup.appointment.domain.MsgNotification;
import com.briup.appointment.service.MsgNotificationService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/notify")
public class NotificationController {

    private final MsgNotificationService notificationService;

    public NotificationController(MsgNotificationService notificationService) {
        this.notificationService = notificationService;
    }

    @GetMapping("/my")
    public ApiResponse<List<MsgNotification>> my(@RequestParam Long userId) {
        return ApiResponse.ok(notificationService.list(new LambdaQueryWrapper<MsgNotification>()
                .eq(MsgNotification::getUserId, userId)));
    }
}


